package org.goyo.common.baseBean;
/**
 * ajax返回值
 * @author chenchuan
 *
 */
public class AjaxResult {
	public static final String SUCCESS = "SUCCESS";
	public static final String FAILE = "FAILE";
	/**
	 * 状态码
	 */
	private String code;
	/**
	 * 消息
	 */
	private String message;
	/**
	 * 数据
	 */
	private Object data;
	
	private String str;
	
	/**
	 * 返回成功
	 * 
	 * @author chenchuan
	 * 2014年10月26日
	 */
	public static AjaxResult resultSuccess(String msg,Object data){
		AjaxResult result = new AjaxResult();
		result.setCode(SUCCESS);
		result.setMessage(msg);
		result.setData(data);
		return result;
	}
	
	/**
	 * 返回失败
	 * 
	 * @author chenchuan
	 * 2014年10月26日
	 */
	public static AjaxResult resultFail(String msg,Object data){
		AjaxResult result = new AjaxResult();
		result.setCode(FAILE);
		result.setMessage(msg);
		result.setData(data);
		return result;
	}
	
	public static AjaxResult resultSuccess(String msg,Object data,String str){
		AjaxResult result = new AjaxResult();
		result.setCode(SUCCESS);
		result.setMessage(msg);
		result.setData(data);
		result.setStr(str);
		return result;
	}	

	public String getMessage() {
		return message;
	}

	public void setMessage(String message) {
		this.message = message;
	}

	public Object getData() {
		return data;
	}

	public void setData(Object data) {
		this.data = data;
	}

	public String getCode() {
		return code;
	}

	public void setCode(String code) {
		this.code = code;
	}

	public String getStr() {
		return str;
	}

	public void setStr(String str) {
		this.str = str;
	}

	
	
}
